package and.example.data;

import and.example.interfaces.IArguments;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

public class DatabaseOpenHelper extends SQLiteOpenHelper implements IArguments{

	public DatabaseOpenHelper(Context context, String name,
			CursorFactory factory, int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {

		String createQuery = "create table " + COLUMNS[0] + "( " + COLUMNS[1]
				+ " integer primary key autoincrement," + COLUMNS[2] + " text,"
				+ COLUMNS[3] + " text," + COLUMNS[4] + " text," + COLUMNS[5]
				+ " text," + COLUMNS[6] + " text, " + COLUMNS[7] + " text);";
		db.execSQL(createQuery);
		
		db.execSQL("INSERT INTO " + COLUMNS[0] + " VALUES (1, 'Donald1','89080','ytrytr','ytr','ytr','ytr')");		
		db.execSQL("INSERT INTO " + COLUMNS[0] + " VALUES (2, 'Donald2','65466','ytr','ytr','ytr','ytr')");		
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("drop table if exists contacts");
		onCreate(db);
	}

}